<style type="text/css">
    .headNav-wrap { position: absolute; top: 7px; right: 10px; text-align: right; color: #fff; }
	.headNav-wrap img ,.headNav-wrap span { vertical-align: middle; }
    .spec_dialog{position:fixed; z-index:11;}
    .dialog-win{ height: 80%; }
    .dialog { height: 100%; }
    .dialog-body { overflow-y: auto; }
</style>
<header class="layout head padding-small">
    <!--商品详情页S-->
    <a href="javascript:back(true);" class="hBack float-left"></a>
    <h4 class="hTxt float-left text-center text-white">商品详情页</h4>
    <!--下面的div是网站导航-->
    <a url="index.php" class="headNav-wrap app_onclick">
        <img src="<?php echo TEMPLATES_PATH ?>/images2/logo.png" width="25%"/><span> 首页</span>
    </a>
    <!--商品详情页E-->
</header>
<?php if($output['miaosha_flag']){?>
    <script type="text/javascript">
        /*倒计时*/
        var downtimes;
        var downendtime = "<?php $att = $output['miaosha_info']['miaosha_status']==1?$output['miaosha_info']['miaosha_endtime']:$output['miaosha_info']['miaosha_starttime'];echo $att -time();?>";
        var miaosha_status = "<?php echo $output['miaosha_info']['miaosha_status'];?>";
        function downtime(){
            var date = new Date();
            //var time = date.getTime()/1000;  //毫秒数
            downendtime -= 1;
            //计算天、时、分、秒、
            var days = Math.floor(downendtime / (1 * 60 * 60 * 24));
            var hours = Math.floor(downendtime / (1 * 60 * 60)) % 24;
            var minutes = Math.floor(downendtime / (1 * 60)) % 60;
            var seconds = Math.floor(downendtime / 1) % 60;
            if (days < 0)
                days = 0;
            if (hours < 0)
                hours = 0;
            if (minutes < 0)
                minutes = 0;
            if (seconds < 0)
                seconds = 0;
            //将天、时、分、秒插入到html中
            if(days ==0 && hours== 0 && minutes==0 && seconds==0){
                clearTimeout(downtimes);
            }
            if(days ==0 && hours== 0 && minutes==0 && seconds==0 && miaosha_status== '2'){
                window.location.reload();
            }
            $(".u-time").html("<span class=\"ms_day\">"+days+" 天</span><span class=\"ms_hour\">"+hours+" 小时</span><span class=\"ms_min\">"+minutes+"</span><span class=\"ms_mao\">：</span><span class=\"ms_ms\">"+seconds+"</span>");
            downtimes = setTimeout("downtime()", 1000);
        }
        downtime();
    </script>
<?php }?>

<script>
    function iconShow(msg) {
        var i = new Date().getTime() / 1000;
        var c = Math.floor(endTime - i);
        if (c > 0) {
            setTimeout("iconShow()", 1000);
            $("#guanzhu").html(msg);
            var a = document.documentElement.clientWidth || document.body.clientWidth;
            var domW = $('#save').innerWidth();
            var d = (a / 2) - (domW / 2);
            $('#save').css('left',d + 'px');
            var h = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
            var b = document.documentElement.clientHeight || document.body.clientHeight;
            var domH = $('#save').innerHeight();
            var g = h - (domH / 2) + (b / 2);
            $('#save').css('top',g + 'px');
            $(".pop-attention").show()
        } else {
            $(".pop-attention").hide()
        }
    }
</script>
<!--收藏、分享、进货车等S-->
<div class="goods-fix layout text-center" style="z-index:10;">
	<a href="javascript:;" id="attention" class="x2 collect" data-goods_id="<?php echo $output['goods']['goods_id']?>"><span class="icon-heart text-big text-d60079 <?php echo isset($output['is_fav']) && $output['is_fav']?'':'icon-heart-o';?>"></span><p class="curr" >收藏</p></a>
    <a href="javascript:;" class="x2 share" onclick="shareSystem(<?php echo $_SESSION['member_id']?$_SESSION['member_id']:0;?>,'<?php echo $GLOBALS['share_msg'];?>','<?php echo $GLOBALS['share_link'];?>');"><span></span><p>分享</p></a>
<!--    <a href="javascript:;" class="x2 custom" onclick="aFloatTools_Show()"><span></span><p>客服</p></a>-->
    <a href="tel:4006315121" class="x2 custom"><span></span><p>客服</p></a>
    <?php if($output["store_self"]=='1' && $_SESSION['is_login'] == '1'){ ?>
    <a href="javascript:onclick(myGoods());" class="x3 bg-ef7f7e text-white cart"><span></span><p>加入进货车</p></a>
    <a href="javascript:onclick(myGoods());" class="x3 bg-red text-white buy"><span></span><p>立即购买</p></a>
    <?php }elseif($output['miaosha_flag'] == 1 && $output['miaosha_info']['miaosha_status'] == 1){?>
    <a href="javascript:buy('buynow');" class="x3 bg-red text-white buy"><span></span><p>立即秒杀</p></a>
    <?php }elseif($output['miaosha_flag'] == 1 && $output['miaosha_info']['miaosha_status'] == 2){?>
    <a href="javascript:onclick(alert('秒杀活动还未开始'));"  class="x3 bg-red text-white buy"><span></span><p>立即秒杀</p></a>
    <?php }elseif($output['goods']['special_offer'] == 1 && !$output['is_give_points']){ ?>
    <a href="javascript:onclick(alert('您对订单未满300元，还暂时不满足要求，赶快下单采购吧。'));" class="x3 bg-ef7f7e text-white cart"><span></span><p>加入进货车</p></a>
    <a href="javascript:onclick(alert('您对订单未满300元，还暂时不满足要求，赶快下单采购吧。'));" class="x3 bg-red text-white buy"><span></span><p>立即购买</p></a>
    <?php }elseif(!$output['is_alliance_member'] && $output['is_alliance_brand']){ //商品为加盟商品，用户为非加盟商，提示加盟后可采购商品?>
        <a href="javascript:alert('请加盟该品牌后再继续购买商品')" class="x3 bg-ef7f7e text-white cart"><span></span><p>加入购物车</p></a>
        <a url="index.php?act=brand_alliance&brand_id=<?php echo $output['is_alliance_brand'];?>" class="x3 bg-red text-white buy app_onclick"><span></span><p>加盟采购</p></a>
    <?php }elseif($output['is_alliance_member'] && $output['is_alliance_brand']){  //商品为加盟商品，用户为加盟商，可采购商品?>
        <?php if($output['alliance_info']['is_paid'] == 1 && $output['alliance_info']['is_effective'] == 1){?>
            <a href="javascript:alert('您已加盟该品牌，请先支付加盟费用');pclicked('index.php?act=brand_alliance&op=alliance_pay&brand_id=<?php echo $output['alliance_info']['brand_id'];?>');" class="x3 bg-ef7f7e text-white cart"><span></span><p>加入购物车</p></a>
            <a href="javascript:alert('您已加盟该品牌，请先支付加盟费用');pclicked('index.php?act=brand_alliance&op=alliance_pay&brand_id=<?php echo $output['alliance_info']['brand_id'];?>');" class="x3 bg-red text-white buy"><span></span><p>加盟采购</p></a>
        <?php }elseif($output['alliance_info']['is_paid'] == 2 && $output['alliance_info']['is_effective'] == 1){?>
            <a href="javascript:alert('品牌保证金不足，加盟已失效');" class="x3 bg-ef7f7e text-white cart"><span></span><p>加入购物车</p></a>
            <a href="javascript:alert('品牌保证金不足，加盟已失效');" class="x3 bg-red text-white buy"><span></span><p>加盟采购</p></a>
        <?php }else{ ?>
            <a href="javascript:buy('')" class="x3 bg-ef7f7e text-white cart"><span></span><p>加入购物车</p></a>
            <a href="javascript:buy('buynow')" class="x3 bg-red text-white buy"><span></span><p>立即购买</p></a>
        <?php }?>
    <?php }else{?>
    <a href="javascript:buy('')" class="x3 bg-ef7f7e text-white cart"><span></span><p>加入进货车</p></a>
    <a href="javascript:buy('buynow')" class="x3 bg-red text-white buy"><span></span><p>立即购买</p></a>
    <?php }?>

</div>


<form id="buynow_form" method="get" action="index.php">
    <input id="act" name="act" type="hidden" value="order" />
    <input id="op" name="op" type="hidden" value="show_buynow_order" />
    <input id="buynow_spec_id" name="buynow_spec_id" type="hidden"/>
    <input id="buynow_quantity" name="buynow_quantity" type="hidden" value='1' />
    <?php if($output['is_alliance_brand']){?>
        <input name="buy_tag" type="hidden" value='<?php echo BUY_TAG_BRAND;?>' />
        <input name="brand_id" type="hidden" value='<?php echo $output['alliance_info']['brand_id'];?>' />
    <?php }?>
</form>
<!--收藏、分享、进货车等E-->
<!--商品大图轮播S-->
<div class="goodsHead layout bg-white margin-bottom">
    <div class="goodsBanner">
        <div class="banner">
            <ul class="carousel">
                <?php if(count($output['img_list'])>0){?>
                <?php foreach($output['img_list'] as $key=>$val){?>
                  <li class="item"><a href=""><img src="<?php echo $val?>" alt="" width="300" height="300"></a></li>
                    <?php }?>
                <?php }else{?>
                <li class="item"><img src="<?php echo TEMPLATES_PATH;?>/images/touch2013/no_300_300.jpg" alt="" width="300" height="300"></li>
                <?php }?>
            </ul>
        </div>
    </div>
</div>
<!--商品大图轮播E-->
<!--商品买卖信息S-->
<div class="goods-sales layout bg-white padding height  margin-bottom">
	<h5 class="goodsName"><a href="javascript:;"><?php echo $output['goods']['goods_name']?></a></h5>
    <a href="index.php?act=app_download" class="float-right border border-yellow radius clearfix  ">
    	<span class="float-left text-white bg-ef7f7e padding-small height" style="line-height:26px;">立即下载</span>
        <span class="float-right text-ef7f7e text-small padding-small text-center" style="width: 80px; line-height:13px;">下载客户端购物更方便</span>
    </a>
    <div class="goodsPrice">
    	<!--未登录情况
        <span>价格：<a href="javascript:;" class="gPrice text-red text-big">请登陆</a></span>
        -->
        <?php if($_SESSION['is_login'] != 1):?>
            <span>价格：<a url="index.php?act=login" class="gPrice text-red text-big" onClick="pclicked(this);">请登陆</a></span>
        <?php else: ?>
    	    <span class="goods-salePrice text-red text-big <?php if(($output['goods']['store_id']==JKY_STORE_ID)||$output['group_flag'] || ($output['xianshi_flag']&&$output['start_flag'])) echo "goodsOldPrice"; ?>" id="price">&yen;<?php echo (($output['goods']['goods_store_price_interval'] == '' || $output['goods']['spec_open'] == '0')? $output['goods']['goods_store_price'] : $output['goods']['goods_store_price_interval']); ?></span>
        <!--试用妆价格-->
        <?php if($output['goods']['store_id']==JKY_STORE_ID) { ?>
            <div class="text-small">九块邮：<i class="text-ef7f7e">&yen;<?php echo number_format(ACTIVITY_TRIAL_BASE_PRICE,2);?></i></div>
        <?php }?>

        <!--团购价-->
        <?php if(!$output['activity_trial_flag']){?>
        <?php if($output['group_flag']) { ?>
            <div class="text-small">团购：<i class="text-ef7f7e">&yen;<?php echo $output['group_info']['groupbuy_price'];?></i></div>
        <?php }?>

        <!--限时折扣价-->
        <?php if($output['xianshi_flag']) { ?>
            <div class="text-small">限时折扣：<i class="text-ef7f7e" id="xianshi">&yen;<?php echo ncPriceFormat($output['goods']['goods_store_price']*$output['xianshi_goods']['discount']);?></i></div>
                <?php }?>
            <?php }?>

        <?php if($output['miaosha_flag']){?>
            <div>
                <div class="text-small">秒杀价：<i class="text-ef7f7e">&yen;<?php echo ncPriceFormat($output['goods']['miaosha_price']);?></i></div>
            </div>
            <?php if($output['goods']['miaosha_starttime'] > time()){?>
                <div class="origin-ms" style="display: inline;">
                    <span class="ms_str"  style="color:#D60079;display: inline-block;font-size: 12px;">距离开始还有</span>
                    <div class="u-time" endtime="<?php echo  $output['goods']['miaosha_starttime']; ?>" u-data="2" style="color:#D60079;display: inline-block;font-size: 12px;">
                        <span class="ms_day"></span><span class="ms_hour"></span><span class="ms_min"></span><span class="ms_ms"></span>
                    </div>
                </div>
            <?php }elseif($output['miaosha_info']['miaosha_status']==3){?>
                <div class="origin-ms" style="display: inline;">
                    <span class="ms_str"  style="color:#D60079;display: inline-block;font-size: 12px;">敬请期待下一期的秒杀活动</span>

                </div>
            <?php }else{?>
                <div class="origin-ms" style="display: inline;">
                    <span class="ms_str"  style="color:#D60079;display: inline-block;font-size: 12px;">距离结束还有</span>
                    <div class="u-time" endtime="<?php echo  $output['goods']['miaosha_endtime']; ?>" style="color:#D60079;display: inline-block;font-size: 12px;">
                        <span class="ms_day"></span><span class="ms_hour"></span><span class="ms_min"></span><span class="ms_ms"></span>
                    </div>
                </div>
            <?php }?>
        <?php }?>
        <?php endif; ?>

        <?php if($output['is_alliance_brand']){?>
            <a style="font-size:14px;float: right;" url="index.php?act=brand&op=brand_goods&brand_id=<?php echo $output['is_alliance_brand'];?>" class="app_onclick">更多商品&gt;&gt;</a>
        <?php }?>

        <?php if($output['relation_goods_id'] > 0){?>
            <a style="font-size:14px;float:right" url="<?php echo ncUrl(array('act'=>'goods','goods_id'=>$output['relation_goods_id']),'goods');?>" class="app_onclick">购买更多&gt;&gt;</a>
        <?php }?>
    </div>
    <input type="hidden" value="<?php echo $output['desc_image']?>" id="imgs">
    <!--  快递-->
    <?php if(false){?>
    <?php if($output['activity_trial_flag']) { ?>
    <div class="kd">快递：<span class="text-ef7f7e"><?php echo $output['activity_row']['activity_title'];?>商品免邮费</span></div>
    <?php }elseif($output['group_flag']) { ?>
    <div class="kd">快递：<span class="text-ef7f7e">团购商品免运费</span></div>
    <?php } else { ?>
    <?php if ($output['goods']['goods_transfee_charge'] == 1){?>
    <div class="kd">快递：<span class="text-ef7f7e">卖家承担运费</span></div>
    <?php }else{?>
        <?php if ($output['goods']['transport_id'] != '0'){?>
                <select name="area_list" id="area_list">
                    <option value="0">全国</option>
                    <?php foreach($output['area_list'] as $k=>$v){?>
                        <option value="<?php echo $k?>"><?php echo $v?></option>
                    <?php }?>
                </select>
            <?php }?>
            <?php if ($output['goods']['py_price'] > 0 || $output['goods']['kd_price'] > 0 || $output['goods']['es_price'] > 0){?>
                <div id="move_to">至 <em style="color:#F66" id="to_area">全国</em>：
                    <?php if ($output['goods']['py_price'] > 0){?>平邮： <em id="nc_py"><?php echo $output['goods']['py_price'];?></em> 元<?php }?>
                    <?php if ($output['goods']['kd_price'] > 0){?>快递： <em id="nc_kd"><?php echo $output['goods']['kd_price'];?></em> 元<?php }?>
                    <?php if ($output['goods']['es_price'] > 0){?>EMS： <em id="nc_es"><?php echo $output['goods']['es_price'];?></em> 元<?php }?>
                </div>
                <?php }?>
            <?php }?>
        <?php }?><?php }?>
    <!--   重量     -->
    <?php if ($output['goods']['goods_weight'] > 0){?>
    <div class="goodsWeight">重量：<span><?php echo round($output['goods']['goods_weight'],2);?>kg</span></div>
    <?php }?>

    <!--  体积  -->
    <?php if ($output['goods']['goods_volume'] > 0){?>
    <div class="goodsWeight">体积：<span><?php echo round($output['goods']['goods_weight'],2);?>m³</span></div>
    <?php }?>

    <!--  销量  -->
    <div class="salesNum">销量：<span><?php echo ($output['goods']['salenum']+$output['sales_num']); ?></span></div>
    <?php if($output['goods']['store_id'] == OFFICIAL_STORE_ID){?>
    <div><img src="<?php echo TEMPLATES_PATH; ?>/images/nice.png" alt="" width="300" height="auto"></div>
    <?php }?>
</div>
<!--商品买卖信息E-->
<!--美达通S-->
<?php if($output['is_mdt'] =='is_mdt'){ ?>
<div class="goods-sales layout bg-white padding margin-bottom height">
	<p id="mdt_price" class="margin-none" id="mdt_js">此商品已参加美达通配送，重量超过5kg后运费更便宜哦（买越多，运费越便宜）。不怕运费贵咯，快点试试吧。</p>
    <a url="index.php?act=article&article_id=190" class="text-ef7f7e app_onclick" id="price_name"><img src="<?php echo TEMPLATES_PATH; ?>/images/mdt_img.jpg" alt="" width="22" height="auto" class="radius margin-right">什么是美达通？</a>
</div>
<div id="gs_fdy" style="display:none;">
    <dl>
        <dd>15kg&le;重量&le;30kg 运费：20元</dd>
        <dd>30kg&lt;重量&le;60kg 运费：35元</dd>
        <dd>60kg&lt;重量&le;90kg 运费：45元</dd>
    </dl>
</div>
<?php }?>
<!--美达通E-->
<!--购买规格及数量S-->
<div class="layout bg-white padding  margin-bottom">

    <?php if($output['goods']['goods_state'] == '0' && $output['goods']['goods_show'] == '1' && $output['goods_storage_total'] !=0){?>
    <?php if(!empty($output['goods']['goods_spec']) && is_array($output['goods']['goods_spec'])){ $i=0;?>
    <?php foreach($output['goods']['spec_name'] as $key=>$val){$i++;?>
	<div class="detail-option spec<?php echo $i;?>" onclick="showSpec(this)" data-target="#mydialog<?php echo $i;?>" data-mask="1" data-width="85%" nctype="spec_val"><?php echo $val;?>：<span class="spec">未选择</span><i class="icon-angle-right float-right"></i></div>
    <?php }?>
    <?php }?>

    <hr>
    <div class="clearfix">
    	<span class="float-left">购买数量：</span>
        <div class="float-left radius text-center border border-ef7f7e goods-num">
                <?php if($output['goods']['store_id']==JKY_STORE_ID) { ?>
            <span class="numWrite inlineBlock" ><input type="text" placeholder="1" id="number" class="text-center border-none" value="1" title="最多可以购买一件" disabled></span>
                <?php }elseif($output['goods']['special_offer'] == 1){ //特价商品只能一件?>
            <span class="numWrite inlineBlock" ><input type="text" placeholder="1" id="number" class="text-center border-none" value="1" title="最多可以购买一件" disabled></span>
                <?php }elseif($output['miaosha_flag'] == 1 && $output['miaosha_info']['miaosha_status'] == 1){ //秒杀商品只能一件?>
            <span class="numWrite inlineBlock" ><input type="text" placeholder="1" id="number" class="text-center border-none" value="1" title="最多可以购买一件" disabled></span>
                <?php }else{ ?>
            <span class=" bg-ef7f7e inlineBlock text-white numDel" onclick="reduce();">-</span>
            <span class="numWrite inlineBlock" ><input type="text" placeholder="1" id="number" class="text-center border-none" value="1"></span>
            <span class="text-white inlineBlock bg-red numAdd" onclick="add();">+</span>
                <?php }?>
        </div>
        <em style="float:right;line-height:38px; display:none;">(当前库存 <strong nctype="goods_stock"><?php echo $output['goods']['spec_goods_storage']; ?></strong> 件)</em>
    </div>
    <?php }else{?>
        <div class="nsg-handle">商品已下架</div>
        <a url="index.php?act=goods&op=daohuo_notice&goods_id=<?php echo $output['goods']['goods_id'];?>" class="nsg-handle app_onclick" style="background: #999 none repeat scroll 0 0; padding:10px;display:block;color: #fff;">到货通知</a>
    <?php }?>

</div>

<?php if(!empty($output['goods']['goods_spec']) && is_array($output['goods']['goods_spec'])){ $i=0;?>
<?php foreach($output['goods']['spec_name'] as $key=>$val){$i++;?>
<div id="mydialog<?php echo $i ?>">
    <div class="dialog">
        <div class="dialog-head">
            <span class="close rotate-hover"></span>
            <strong><?php echo $val;?>选择</strong>
        </div>
        <div class="dialog-body spec-btn" data-dome="spec<?php echo $i ?>">
        	<div style="overflow: hidden;">
		            <?php if (is_array($output['goods_spec'][$key]) and !empty($output['goods_spec'][$key])) {?>
		            <?php $j=0;foreach($output['goods_spec'][$key] as $k=>$v) {?>
                            <?php if(is_array($output['goods_col_img']) && isset($output['goods_col_img'][$v]) && $output['goods_col_img'][$v] != ''){?>
                            <!--图片规格-->
                            <span  data_key="<?php echo $i.'_'.$k;?>" onClick="selectSpec(<?php echo $i;?>, this, <?php echo $k;?>)" class="float-left radius-small border border-ef7f7e spec_img" style=" background-image: url(<?php echo SiteUrl.DS.ATTACH_SPEC.DS.$output['goods']['store_id'].DS.$output['goods_col_img'][$v];?>);"><span><?php echo $v;?></span></span>
                            <?php }else{?>
                            <span class="float-left radius-big border border-ef7f7e " data_key="<?php echo $i.'_'.$k;?>" onclick="selectSpec(<?php echo $i;?>,this,<?php echo $k;?>)"><?php echo $v;?></span>
                            <?php }?>
		    <?php }?>
                    <?php }?>
        	</div>
        </div>
        <div class="dialog-foot">
            <button class="button dialog-close bg-green">确认</button>
        </div>
		<script type="text/javascript">
			$(function(){
				var dialogh = $(window).height()*0.8-96;
		        $('.dialog-body').height(dialogh);
			})
		</script>
    </div>
</div>
    <?php } ?>
<?php } ?>
<style>
    .spec-btn span.spec_img{width: 32px;height:44px;position:relative;font-size:12px;background-position: left top;background-repeat: no-repeat !important;}
    .spec-btn span.spec_img span{ position: absolute;
        left: 0px;
        top: 32px;
        width: 32px;
        height: 13px;
        overflow: hidden;
        line-height: 13px;margin:0;padding:0px 0px;}
</style>
<!--购买规格及数量E-->
<!--商品商城S-->
<div class="layout bg-white padding  margin-bottom">
    <!--  九块邮商城   -->
    <?php if($output['goods']['store_id']==JKY_STORE_ID) { ?>
	<div class="clearfix" id="shopName">
    	<span class="shopLogo float-left"><img src="/templates/default/images/member/mdt_store_min.png" alt=""></span>
        <h5 class="shop-name float-left height">美财网九块邮官方商品</h5>
    </div>
    <?php } ?>

    <div class="clearfix padding text-center text-small">
   		<div class="x4">描述相符：<span class="text-red"><?php echo $output['store_info']['goods_quality_credit'] != 0?round((1-5/$output['store_info']['goods_quality_credit'])*5,1):'无';?><?php echo $lang['nc_grade'];?></span></div>
   		<div class="x4">服务态度：<span class="text-red"><?php echo $output['store_info']['shipping_speed_credit'] != 0?round((1-5/$output['store_info']['shipping_speed_credit'])*5,1):'无';?></span></div>
   		<div class="x4">发货速度：<span class="text-red"><?php echo $output['store_info']['goods_quality_credit'] !=0?round((1-5/$output['store_info']['goods_quality_credit'])*5,1):'无';?></span></div>
    </div>
    <div class="goods-shopBtn">
    	<a url="index.php?act=show_store&id=<?php echo $output['goods']['store_id'];?>&url_type=1" class="float-left text-center bg-ef7f7e text-white radius-big clearfix" onClick="pclicked(this);">
        	<i class="shopIcon float-left padding-right"></i><span class="float-left">进入商城</span>
        </a>
		<a url="index.php?act=show_store&id=<?php echo $output['goods']['store_id']?>" class="float-right text-center bg-ef7f7e text-white radius-big clearfix" onClick="pclicked(this);">
        	<i class="allGoodsIcon float-left padding-right"></i><span class="float-left">全部商品</span>
        </a>
    </div>
</div>
<!--商品商城E-->
<!--商品属性、图文介绍、评论S-->
<div class="goodsTab layout text-center fixed">
	<a url="#goodsClass1" class="goodsClass-btn text-white x4 height-large bg-yellow">商品属性</a>
    <a url="#goodsIntroduce2" class="goodsIntroduce-btn text-white x4 height-large border-left-right border-yellow">图文介绍</a>
	<a url="#goodsComment3" class="goodsComment-btn text-white x4 height-large">评论（0）</a>
</div>
<div class="goodsClass bg-white layout padding " id="goodsClass1">
    <?php if(is_array($output['goods']['goods_attr']) && !empty($output['goods']['goods_attr'])){?>
    <?php foreach ($output['goods']['goods_attr'] as $val){
        $valArr=array_splice($val,1);
        echo '<p class="margin-none height" title="'.htmlspecialchars(join(',',$valArr)).'">'.htmlspecialchars($val['name']).'：'.htmlspecialchars(join(',',$valArr)).'</p>';
    }?>
    <?php }?>
</div>
<div class="goodsIntroduce bg-white layout" id="goodsIntroduce2">
    <!--公共头部 Start-->
    <?php if(!empty($output['gds']) && is_array($output['gds'])){?>
        <?php foreach ($output['gds'] as $val){ ?>
            <?php if(is_file(BasePath.DS.$val['top_img']) && !empty($val['top_link'])){?>
                <a url="<?php echo replace_link($val['top_link']);?>" onClick="pclicked(this);">
                    <img src="<?php echo SiteUrl.DS.$val['top_img'];?>" style="max-width:100%;"/>
                </a>
            <?php }else if(is_file(BasePath.DS.$val['top_img']) && empty($val['top_link'])){?>
                <img src="<?php echo SiteUrl.DS.$val['top_img'];?>" style="max-width:100%;"/>
            <?php }?>
        <?php }?>
    <?php }?>
    <!--公共头部 End-->
    <?php echo htmlspecialchars_decode($output['goods']['goods_body']);?>
    <!--公共底部 Start-->
    <?php if(!empty($output['gds']) && is_array($output['gds'])){?>
        <?php foreach ($output['gds'] as $val){ ?>
            <?php if(is_file(BasePath.DS.$val['but_img']) && !empty($val['but_link'])){?>
                <a url="<?php echo replace_link($val['but_link']);?>" onClick="pclicked(this);">
                    <img src="<?php echo SiteUrl.DS.$val['but_img'];?>" style="max-width:100%;"/>
                </a>
            <?php }else if(is_file(BasePath.DS.$val['but_img']) && empty($val['but_link'])){?>
                <img src="<?php echo SiteUrl.DS.$val['but_img'];?>" style="max-width:100%;"/>
            <?php }?>
        <?php }?>
    <?php }?>
    <!--公共底部 End-->
</div>
<div class="goodsComment bg-white layout padding" id="goodsComment3">
    <div class="gc-mainWork margin-bottom">
    </div>
    <ul class="gc-con padding-none text-small" id="comment">
<!--        <li class="gc-list border border-red-light radius-big padding-small ">-->
<!--            <h4 class="date">做第一个评论的人吧~！</h4>-->
<!--        </li>-->
    </ul>
</div>
<div class="cart-pop" id="cart" style="display: none; position: absolute; bottom: 50%; z-index: 10002; left: 66px;">
    <div class="ico-succ">
        <span class="att-succ">添加成功！</span>
        <span class="cart-succ">商品已成功加入进货车</span>
    </div>
    <div class="cp-lnk">
        <a href="javascript:void(0)" onclick="cart_hide();" id="stroll">再逛逛</a>
        <a url="index.php?act=cart<?php if($output['is_alliance_brand']){ echo '&brand_id='.$output['goods']['brand_id'];}?>" id="goCart" onClick="pclicked(this);" ><span class="bar"></span>去进货车</a>
    </div>
</div>
<!--商品属性、图文介绍、评论E-->
<!--店家推荐S-->
<div class="goodsRecommend  bg-white layout padding margin-top">
	<h5 class="padding-bottom">商品推荐</h5>
    <div class="gr-list layout">
    	<div ontouchstart="touchStart(event)" ontouchmove="touchMove(event);" ontouchend="touchEnd(event);">
            <ul class="gr-con padding-none" id="slide">
                <?php
                if(!empty($output['goods_commend']) && is_array($output['goods_commend'])){ $i= 0;
                foreach($output['goods_commend'] as $item){ $i++;
                ?>
                <li class="item padding-small border border-red-light text-center radius-big margin-small-right">
                    <a url="index.php?act=goods&goods_id=<?php echo $item['goods_id'];?>" class="text-left" onClick="pclicked(this);">
                    	<span class="gr-goodsImg" ><img src="<?php echo SiteUrl.DS.ATTACH_GOODS.DS.$item['store_id'].DS.$item['goods_image'];?>" alt="<?php echo $item['goods_name']?>" width="90" height="90" onerror="this.src='<?php echo TEMPLATES_PATH;?>/images/touch2013/no_100_100.jpg'"></span>
                        <h5 class="text-small gr-goodsName"><?php echo $item['goods_name']?></h5>
                        <span class="goods-salePrice text-red text-small ">
                        <?php if($_SESSION['is_login'] != 1){?>
                            登录后显示
                        <?php }else{?>
                        &yen;
                        <?php
                        if($item['store_id']==JKY_STORE_ID){
                            echo number_format(ACTIVITY_TRIAL_BASE_PRICE,2);
                        }else{
                            if($item['group_flag']==0 && $item['xianshi_flag']==0){
                                echo $item['goods_store_price'];
                            }else if($item['group_flag']==1 && $item['xianshi_flag']==0){
                                echo $item['group_price'];
                            }else if($item['group_flag']==0 && $item['xianshi_flag']==1){
                                echo ncPriceFormat($item['goods_store_price']*($item['xianshi_discount']/10));
                            }else if($item['group_flag']==1 && $item['xianshi_flag']==1){
                                if($item['group_price'] < ($item['goods_store_price']*($item['xianshi_discount']/10))){
                                    echo $item['group_price'];
                                }else{
                                    echo ncPriceFormat($item['goods_store_price']*($item['xianshi_discount']/10));
                                }

                            }
                        }
                        ?>
                        <?php }?>
                        </span>
                    </a>
                </li>
                <?php }?>
                <?php }?>
            </ul>
        </div>
    </div>
</div>
<!--店家推荐E-->

<!--QQ悬浮-->
<?php if(!empty($output['store_info']['store_presales'])||!empty($output['store_info']['store_aftersales'])){?>
    <div id="floatTools" class="rides-cs">
        <div class="floatL">
            <a id="aFloatTools_Show" class="btnOpen" title="查看在线客服" style="top:20px;display:block" href="javascript:void(0);">展开</a>
            <a id="aFloatTools_Hide" class="btnCtn" title="关闭在线客服" style="top:20px;display:none" href="javascript:void(0);">收缩</a>
        </div>
        <div id="divFloatToolsView" class="floatR" style="width: 140px;">
            <div class="cn">
                <?php if(!empty($output['store_info']['store_presales'])){?>
                    <h3 class="titZx">售前客服</h3>
                    <ul><?php foreach($output['store_info']['store_presales'] as $val){?>
                            <?php if($val['type'] == 1){?>
                                <li><span><?php echo $val['name']?></span> <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=<?php echo $val['num'];?>&site=qq&menu=yes"><img border="0" src="<?php echo TEMPLATES_PATH;?>/images/online.png" alt="点击这里给我发消息" title="点击这里给我发消息"/></a> </li>
                            <?php }elseif($val['type'] == 2&&false){?>
                                <li><span><?php echo $val['name']?></span> <a target="_blank" href="http://amos.im.alisoft.com/msg.aw?v=2&amp;uid=<?php echo $val['num'];?>&site=cntaobao&s=1&charset=<?php echo CHARSET;?>"><img border="0" src="http://amos.im.alisoft.com/online.aw?v=2&uid=<?php echo $val['num'];?>&site=cntaobao&s=1&charset=<?php echo CHARSET;?>" alt="点击这里给我发消息" title="点击这里给我发消息"/></a> </li>
                            <?php }elseif($val['type'] == 3&&false){?>
                                <li><span><?php echo $val['name']?></span> <a target="_blank" href="http://amos.alicdn.com/msg.aw?v=2&uid=<?php echo $val['num'];?>&site=cnalichn&s=1&charset=<?php echo CHARSET;?>"><img border="0" src="http://amos.alicdn.com/online.aw?v=2&uid=<?php echo $val['num'];?>&site=cnalichn&s=1&charset=<?php echo CHARSET;?>" alt="点击这里给我发消息" title="点击这里给我发消息"/></a> </li>
                            <?php }?>
                        <?php }?>
                        <!--<li style="border:none;"><span>电话：400-000-0000</span> </li>-->
                    </ul>
                <?php }?>
                <?php if(!empty($output['store_info']['store_aftersales'])){?>
                    <h3 class="titZx">售后客服</h3>
                    <ul><?php foreach($output['store_info']['store_aftersales'] as $val){?>
                            <?php if($val['type'] == 1){?>
                                <li><span><?php echo $val['name']?></span> <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=<?php echo $val['num'];?>&site=qq&menu=yes"><img border="0" src="<?php echo TEMPLATES_PATH;?>/images/online.png" alt="点击这里给我发消息" title="点击这里给我发消息"/></a> </li>
                            <?php }elseif($val['type'] == 2&&false){?>
                                <li><span><?php echo $val['name']?></span> <a target="_blank" href="http://amos.im.alisoft.com/msg.aw?v=2&amp;uid=<?php echo $val['num'];?>&site=cntaobao&s=1&charset=<?php echo CHARSET;?>"><img border="0" src="http://amos.im.alisoft.com/online.aw?v=2&uid=<?php echo $val['num'];?>&site=cntaobao&s=1&charset=<?php echo CHARSET;?>" alt="点击这里给我发消息" title="点击这里给我发消息"/></a> </li>
                            <?php }elseif($val['type'] == 3&&false){?>
                                <li><span><?php echo $val['name']?></span> <a target="_blank" href="http://amos.alicdn.com/msg.aw?v=2&uid=<?php echo $val['num'];?>&site=cnalichn&s=1&charset=<?php echo CHARSET;?>"><img border="0" src="http://amos.alicdn.com/online.aw?v=2&uid=<?php echo $val['num'];?>&site=cnalichn&s=1&charset=<?php echo CHARSET;?>" alt="点击这里给我发消息" title="点击这里给我发消息"/></a> </li>
                            <?php }?>
                        <?php }?>
                        <!--<li style="border:none;"><span>电话：400-000-0000</span> </li>-->
                    </ul>
                <?php }?>
            </div>
        </div>
    </div>
<?php }?>
<!--QQ悬浮-->
<span class="pop-attention" style="position:absolute;z-index:9999;display:none" id="save">
 	<span class="icon-succ" id="guanzhu"></span>
</span>

</body>
</html>
<script type="text/javascript">
	$(function(){
		$(window).scroll(function(){
			var $header = $('header');
			if($(window).scrollTop() >= 44){
				$header.hide();
			}else{
				$header.show();
			};
		});


    function myGoods(){
        endTime = new Date().getTime() / 1000 + 3;
        iconShow('自家商品，不允许购买');
    }

    $.get('index.php?act=goods&op=comments',{goods_id:"<?php echo $output['goods']['goods_id'];?>",id:<?php echo $output['goods']['store_id'];?>},function(res){
        var conmentDome = '';
        var keyWord = '';

        if(!res.state){
            return;
        }

        if(res.comments.length > 0){
            //评论 内容
            for(var i=0; i<res.comments.length; i++){
                conmentDome += '<li class="gc-list border border-red-light radius-big padding-small "><p class="margin-none"><i class="icon-star text-yellow "></i><i class="icon-star text-yellow "></i><i class="icon-star text-yellow "></i><i class="icon-star text-yellow "></i><i class="icon-star text-yellow "></i>&nbsp;'+res.comments[i].geval_content+'</p><div class="list-text height"><span class="date">'+res.comments[i].geval_addtime+'</span>'+res.comments[i].geval_frommembername+'</div></li>';
            }

            $('#comment').html(conmentDome);
            $('.goodsComment-btn').text('评论('+res.comments.length+')');

            //评论关键词
            for(var k in res.keyword){
                if(res.keyword[k].indexOf(',') == -1){
                    keyWord += '<span class="inlineBlock margin-small padding-small bg-red text-white radius-big ">' + res.keyword[k] + '</span>';
                }else{
                    keyWord += '<span class="inlineBlock margin-small padding-small bg-green text-white radius-big">'+ res.keyword[k].substring(0,res.keyword[k].indexOf(',')) + '</span>';
                }
            }

            $('#goodsComment3 .gc-mainWork').html(keyWord);
        }


    },'json');

    });

    /*QQ悬浮代码*/
    function aFloatTools_Show(){
        $('#floatTools').animate({width:'show',opacity:'show'},100,function(){$('#floatTools').show();});
        $('#aFloatTools_Show').hide();
        $('#aFloatTools_Hide').show();
    }
    function aFloatTools_Hide(){
        $('#floatTools').animate({width:'hide', opacity:'hide'},100,function(){$('#floatTools').hide();});
        $('#aFloatTools_Show').show();
        $('#aFloatTools_Hide').hide();
    }
    $(function(){
        $("#aFloatTools_Show").click(function(){
            aFloatTools_Show();
        });
        $("#aFloatTools_Hide").click(function(){
            aFloatTools_Hide();
        });
    });/*QQ悬浮代码*/
    /*快捷按钮开始*/
    $(function(){
        //path
        $(".plug-div span").click(function(){
            if($('.plug-div').css("right")=="135px"){
                $('.plug-div').animate({right:"59px"},{speed:300});
            }else{
                $('.plug-div').animate({right:"135px"},{speed:300});
            }
            /* var span = $(this).find("span");
             if(span.attr("class") == "open"){

             span.removeClass("open");
             span.addClass("close");
             $(".plug-btn").removeClass("open");
             $(".plug-btn").addClass("close");
             }else{
             span.removeClass("close");
             span.addClass("open");
             $(".plug-btn").removeClass("close");
             $(".plug-btn").addClass("open");
             }*/
        });
        //$(".plug-menu").on('touchmove',function(event){event.preventDefault();});
    });
    /*快捷按钮结束*/
    function myGoods(){
        endTime = new Date().getTime() / 1000 + 3;
        iconShow('自家商品，不允许购买');
    }

    // 商品规格选择js部分
    var SITE_URL = "<?php if($GLOBALS['setting_config']['enabled_subdomain'] == '1' and $output['store_info']['store_domain']!='') echo "http://".$output['store_info']['store_domain'].'.'.$GLOBALS['setting_config']['subdomain_suffix']; else echo SiteUrl;?>";
    var more_spec = new Array();
    function buy(type)
    {
        var o_and_m = false;
        var B = false;
        $('.spec-btn').each(function(){
            if(!$(this).find('span').hasClass('bg-ef7f7e')){
                B = true;
            }
            if($(this).find('.bg-ef7f7e').length > 1){
                o_and_m = true;
            }
        });

        if (goodsspec.getSpec() == null || B)
        {
            endTime = new Date().getTime() / 1000 + 3;
            $("html, body").animate({scrollTop: $('.detail-option').offset().top-100},120);
            iconShow('请选择相关规格');
            return;
        }
        if(o_and_m){
            var spec_id = more_spec;
        }else{
            var spec_id = goodsspec.getSpec().id;
        }
        var quantity = parseInt($("#number").val());
        if (!quantity>=1)
        {
            endTime = new Date().getTime() / 1000 + 3;
            iconShow("请填写购买数量");
            $("#number").val('1');
            return;
        }
        max = parseInt($('[nctype="goods_stock"]').text());
        if(quantity > max){
            endTime = new Date().getTime() / 1000 + 3;
            iconShow("您购买的商品数量超出了该商品库存，请您重新选择商品数量");
            return;
        }

        var buy_tag = $("input[name='buy_tag']").val();

        switch(type) {
            case 'groupbuy' :
                buynow(spec_id,quantity,"groupbuy");
                break;
            case 'buynow':
                buynow(spec_id,quantity,'buynow');
                break;
            default:
                add_to_cart(spec_id, quantity, buy_tag);
                break;
        }
    }

    // 立即购买js
    function buynow(spec_id,quantity,type){
        <?php if ($_SESSION['is_login'] !== '1'){?>
        toLogin();
        <?php }else{?>
        $("#"+type+"_spec_id").val(spec_id);
        $("#"+type+"_quantity").val(quantity);
//        $("#"+type+"_form").submit();
        pclicked('index.php?'+$("#"+type+"_form").serialize());
        <?php }?>
    }


    /* spec对象 */
    function spec(id, spec, price, re_price, stock)
    {
        this.id    = id;
        this.spec  = spec;
        this.price = price;
        this.re_price = re_price;
        this.stock = stock;
    }
    /* goodsspec对象 */
    function goodsspec(specs, specQty, defSpec)
    {
        this.specs = specs;
        this.specQty = specQty;
        this.defSpec = defSpec;
        <?php for ($i=1; $i<=$output['spec_count'];$i++){?>
        this.spec<?php echo $i?> = null;
        <?php }?>
        if (this.specQty >= 1)
        {
            for(var i = 0; i < this.specs.length; i++)
            {
                if (this.specs[i].id == this.defSpec)
                {
                    <?php for ($i=1; $i<=$output['spec_count'];$i++){?>
                    this.spec<?php echo $i?> = this.specs[i].spec[<?php echo (intval($i)-1);?>];
                    <?php }?>
                    break;
                }
            }
        }

        // 取得选中的spec
        this.getSpec = function()
        {
            for (var i = 0; i < this.specs.length; i++)
            {
                <?php for ($i=1; $i<=$output['spec_count'];$i++){?>
                if (this.specs[i].spec[<?php echo (intval($i)-1);?>] != this.spec<?php echo $i?>) continue;
                <?php }?>
                return this.specs[i];
            }
            return null;
//            $('.detail-option').each(function(){
//                if($(this).find('.spec').text() == '未选择'){
//                    return null;
//                }
//            });
//
//            return this.specs[i];
        }

    }
    /* 选中某规格 num=1,2 */
    function selectSpec(num, liObj, SID)
    {
        goodsspec['spec' + num] = SID;
        if($(liObj).hasClass('bg-ef7f7e')){
            more_spec.remove(goodsspec.getSpec().id);
            $(liObj).removeClass("text-white bg-ef7f7e");
        }else{
            more_spec.push(goodsspec.getSpec().id);
            $(liObj).addClass("text-white bg-ef7f7e");
        }
        var spec = goodsspec.getSpec();
        var sign = 't';
        var b_tog = false;
        $('.spec-btn').each(function(){
            if($(this).find('.bg-ef7f7e').length > 1){
                b_tog = true;
            }
            if($(this).find('.bg-ef7f7e').html() == null ){
                sign = 'f';
            }
        });

        if (spec != null && sign == 't')
        {
            $('#price').html('&yen;'+number_format(spec.price,2));
            //限时折扣价格
            <?php if(!empty($output['xianshi_flag']) && !empty($output['xianshi_goods'])) { ?>
            var discount = <?php echo $output['xianshi_goods']['discount'];?>;
            $('#xianshi').html('&yen;'+number_format((spec.price*discount).toFixed(2),2));
            <?php } ?>
            $('[nctype="goods_stock"]').html(spec.stock);
            if(parseInt(spec.stock) == 0){
                iconShow("所选规格库存量不足，请选择其它规格购买");
                //$('[nctype="goods_prompt"]').show().html('<div class="option" style="line-height:34px;"><em>所选规格库存量不足，请选择其它规格购买</em></div>');
            }else{
                SP_V = '';
                $('.spec-btn').find('.bg-ef7f7e').each(function(i){
                    SP_V += $(this).text()+'，';
                });
                SP_V = SP_V.substr(0,SP_V.length-1);
                $('div[nctype="spec_val"]').find('.spec').text('您选择了：'+SP_V);
            }
        }
        if(b_tog){
            $('.buy').attr('onclick',"alert('多选规格请选择加入进货车');");
        }else{
            $('.buy').attr('onclick',"buy('buynow');");
        }
    }

    var specs = new Array();
    var source_goods_price = <?php echo $output['goods']['goods_store_price']; ?>;
    <?php if (is_array($output['spec_array']) and !empty($output['spec_array'])) {
        foreach($output['spec_array'] as $val) {
    ?>
    specs.push(new spec(<?php echo $val['spec_id']; ?>, [<?php echo $val['spec_goods_spec']?>], <?php echo $val['spec_goods_price']; ?>, <?php echo $val['spec_goods_retail_price']; ?>, <?php echo $val['spec_goods_storage']; ?>));
    <?php
        }
     }
    ?>
    var specQty = <?php if($output['goods']['spec_open'] == 1) echo $output['spec_count']; else echo '0'; ?>;
    var defSpec = <?php echo intval($output['spec_array'][0]['spec_id']); ?>;
    var goodsspec = new goodsspec(specs, specQty, defSpec);

    function cart_hide()
    {
        $('#cart').hide();
        $('#_mask').hide();
    }

    /* add cart */
    function add_to_cart(spec_id, quantity, buy_tag)
    {
        //创建遮罩层
        if ($("#_mask")) {
            $("#_mask").remove()
        }
        var l = ((document.body || document.documentElement).clientHeight + 20) + "px";
        var a = "100%";
        var n = document.createElement("div");
        n.setAttribute("id", "_mask");
        n.setAttribute("style", "position:absolute;left:0px;top:0px;background-color:rgb(20, 20, 20);filter:alpha(opacity=60);opacity: 0.6;width:" + a + ";height:" + l + ";z-index:10001;");
        (document.body || document.documentElement).appendChild(n);

        var url = 'index.php?act=cart&op=add';
        $.getJSON(url, {'spec_id':spec_id, 'quantity':quantity, 'buy_tag':buy_tag}, function(data){
            if(data != null){
                if (data.done)
                {
                    //计算提示框到顶部的高度
                    var r = 100;
                    var q = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
                    var s = document.documentElement.clientHeight || document.body.clientHeight;
                    document.getElementById("cart").style.bottom = ((s - r) / 2 - q) + "px";
                    $('#cart').show();
                    setTimeout('cart_hide()', 5000);
                }
                else
                {
                    endTime = new Date().getTime() / 1000 + 3;
                    iconShow(data.msg);
                    setTimeout('cart_hide()', 3000);
                }

            }
        });
    }

    $(function(){
        //选择地区查看运费
        $('select[name=area_list]').change(function(){
            var id = $(this).val();
            var area = $(this).find("option:selected").text();
            if (id=='undefined') return false;
            var tpl_id = '<?php echo $output['goods']['transport_id'];?>';
            var weight = '<?php echo $output['goods']['goods_weight'];?>';
            var volume = '<?php echo $output['goods']['goods_volume'];?>';
            var url = 'index.php?act=goods&op=calc&rand='+Math.random();
            var quantity  =$('#number').val();
            $.getJSON(url, {'id':id,'tid':tpl_id,'weight':weight,'volume':volume,'quantity':quantity}, function(data){
                if (data == null) return false;
                if(data.kd != 'undefined') {$('#nc_kd').html(data.kd);}else{$('#nc_kd').html('');}
                if(data.py != 'undefined') {$('#nc_py').html(data.py);}else{$('#nc_py').html('');}
                if(data.es != 'undefined') {$('#nc_es').html(data.es);}else{$('#nc_es').html('');}
                $('#to_area').html(area);
            });
        });
    });

    //选择数量美达通运费变化
    var current_num =1;            //初始商品数量
    var mdt_yf_all =1;           //总共美达通运费
    <?php if($output['mdt_info'] && !empty($output['mdt_info'])){?>
    if((<?php echo $output['goods']['goods_weight'];?> * current_num - <?php echo $output['mdt_info']['snum'];?>)>0){
        mdt_yf_all =((<?php echo $output['goods']['goods_weight'];?>*current_num-<?php echo $output['mdt_info']['snum'];?>)*(<?php echo $output['mdt_info']['xprice'];?>/<?php echo $output['mdt_info']['xnum'];?>))+<?php echo $output['mdt_info']['sprice'];?>;
    }else{
        mdt_yf_all =<?php echo $output['mdt_info']['sprice'];?>;
    }
    $('#mdt_yf').html(number_format(mdt_yf_all,2));
    <?php }?>

    function transport(){
        <?php if(!$output['activity_trial_flag'] && !$output['group_flag'] && $output['goods']['goods_transfee_charge'] != 1){?>
        current_num = $("#number").val();
        var id = $('select[name=area_list]').val();
        if (id=='undefined') return false;
        var tpl_id = '<?php echo $output['goods']['transport_id'];?>';
        var weight = '<?php echo $output['goods']['goods_weight'];?>';
        var volume = '<?php echo $output['goods']['goods_volume'];?>';
        var url = 'index.php?act=goods&op=calc&rand='+Math.random();
        var quantity  =current_num;
        $.getJSON(url, {'id':id,'tid':tpl_id,'weight':weight,'volume':volume,'quantity':quantity}, function(data){
            if (data == null) return false;
            if(data.kd != 'undefined') {$('#nc_kd').html(data.kd);}else{$('#nc_kd').html('');}
            if(data.py != 'undefined') {$('#nc_py').html(data.py);}else{$('#nc_py').html('');}
            if(data.es != 'undefined') {$('#nc_es').html(data.es);}else{$('#nc_es').html('');}
        });
        <?php if($output['mdt_info'] && !empty($output['mdt_info'])){?>
        if((<?php echo $output['goods']['goods_weight'];?>*current_num -<?php echo $output['mdt_info']['snum'];?>)>0){
            mdt_yf_all =((<?php echo $output['goods']['goods_weight'];?>*current_num-<?php echo $output['mdt_info']['snum'];?>)*(<?php echo $output['mdt_info']['xprice'];?>/<?php echo $output['mdt_info']['xnum'];?>))+<?php echo $output['mdt_info']['sprice'];?>;
        }else{
            mdt_yf_all =<?php echo $output['mdt_info']['sprice'];?>;
        }

        <?php if($output['goods']['store_id']==OFFICIAL_STORE_ID){?>
        $cstep =0;
        if(<?php echo $output['goods']['goods_weight'];?>*quantity ==<?php echo $output['supermarket_delivery'][0]['delivery_weight'];?>){
            mdt_yf_all =<?php echo $output['supermarket_delivery'][0]['delivery_cost']?>;
            $cstep =1;
        }else if((<?php echo $output['goods']['goods_weight'];?>*quantity > <?php echo $output['supermarket_delivery'][0]['delivery_weight'];?>) && (<?php echo $output['goods']['goods_weight'];?>* quantity <= <?php echo $output['supermarket_delivery'][1]['delivery_weight'];?>)){
            mdt_yf_all =<?php echo $output['supermarket_delivery'][1]['delivery_cost']?>;
            $cstep =1;
        }else if((<?php echo $output['goods']['goods_weight'];?>*quantity > <?php echo $output['supermarket_delivery'][1]['delivery_weight'];?>) && (<?php echo $output['goods']['goods_weight'];?>* quantity <= <?php echo $output['supermarket_delivery'][2]['delivery_weight'];?>)){
            mdt_yf_all =<?php echo $output['supermarket_delivery'][2]['delivery_cost']?>;
            $cstep =1;
        }else if((<?php echo $output['goods']['goods_weight'];?>*quantity > <?php echo $output['supermarket_delivery'][2]['delivery_weight'];?>) && (<?php echo $output['goods']['goods_weight'];?>* quantity <= <?php echo $output['supermarket_delivery'][3]['delivery_weight'];?>)){
            mdt_yf_all =<?php echo $output['supermarket_delivery'][3]['delivery_cost']?>;
            $cstep =1;
        }else if(<?php echo $output['goods']['goods_weight'];?>*quantity > <?php echo $output['supermarket_delivery'][3]['delivery_weight'];?>){
            mdt_yf_all =<?php echo $output['goods']['goods_weight'];?>*quantity* <?php echo $output['supermarket_delivery'][4]['delivery_price'];?>;
            $cstep =1;
        }
        if($cstep ==1){
            $('#mdt_price').removeClass('mdt_fee_price').addClass('fdy_fee_price');
            $('#price_name').text('封顶邮运费');
            $('#gs_fdy').show();
        }else{
            $('#mdt_price').removeClass('fdy_fee_price').addClass('mdt_fee_price');
            $('#price_name').text('美达通运费');
            $('#gs_fdy').hide();
        }
        $cstep =0 ;
        <?php }?>
        $('#mdt_yf').html(number_format(Math.ceil(mdt_yf_all),2));
        <?php }?>
        <?php }?>
    }

    function reduce() {
        var a = parseInt($("#number").val(), 10);
        if (a <= 1) {
            $("#number").val(1)
        } else {
            a--;
            $("#number").val(a)
        }
        transport();
    }
    function add() {
        var a = parseInt($("#number").val(), 10);
        max = parseInt($('[nctype="goods_stock"]').text());
        if(a < max){
            $('#number').val(a+1);
        }else{
            iconShow('亲，没有更多宝贝了，赶紧下手吧~！');  //此处无法弹框
        }
        transport();
    }
    function modify() {
        var a = parseInt($("#number").val(), 10);
        max = parseInt($('[nctype="goods_stock"]').text());
        if ("" == $("#number").val()) {
            $("#number").val(1);
        }
        if (!isNaN(a)) {
            if (1 > a || a >max) {
                endTime = new Date().getTime() / 1000 + 3;
                iconShow('输入的数值范围错误！');
                $("#number").val(1);
            }else{
                $("#number").val(a);
            }
        } else {
            $("#number").val(1);
        }
        transport();
    }

//    $('.goods-fix .collect').click(function(){
//        $(this).find('span').toggleClass('icon-heart-o');
//    })

    //收藏商品js
//    function collect_goods(fav_id,jstype,jsobj){
//        <?php //if ($_SESSION['is_login'] !== '1'){?>
//        toLogin();
//        <?php //}else{?>
//        $.get('index.php?act=index&op=login', function(result){
//            if(result=='0'){
//                login_dialog();
//            }else{
//                var url = 'index.php?act=member_favorites&op=favoritesgoods';
//                $.getJSON(url, {'fid':fav_id}, function(data){
//                    if (data.done)
//                    {
//                        //showDialog(data.msg, 'succ','','','','','','','','',2);
//                        if(jstype == 'count'){
//                            $('[nctype="'+jsobj+'"]').each(function(){
//                                $(this).html(parseInt($(this).text())+1);
//                            });
//                        }
//                        if(jstype == 'succ'){
//                            //$('[nctype="'+jsobj+'"]').each(function(){
//                                //$(this).html("收藏成功");
//                                iconShow('收藏成功');//此处无法弹框
//                                $('.goods-fix .collect').find('span').removeClass('icon-heart-o');
//                               // $('.goods-fix .collect').find('span').addClass('icon-heart');
//                            //});
//                        }
//                    }
//                    else
//                    {
//                        //$('.goods-fix .collect').find('span').addClass('icon-heart');
//                        //showDialog(data.msg, 'notice');
//                        iconShow('已经收藏过');//此处无法弹框
//                        $('.goods-fix .collect').find('span').removeClass('icon-heart-o');
//                    }
//                });
//            }
//        });
//        <?php //}?>
//    }

    function iconShow(msg) {
        var i = new Date().getTime() / 1000;
        var c = Math.floor(endTime - i);
        if (c > 0) {
            setTimeout("iconShow()", 1000);
            $("#guanzhu").html(msg);
            var a = document.documentElement.clientWidth || document.body.clientWidth;
            var domW = $('#save').innerWidth();
            var d = (a / 2) - (domW / 2);
            $('#save').css('left',d + 'px');
            var h = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
            var b = document.documentElement.clientHeight || document.body.clientHeight;
            var domH = $('#save').innerHeight();
            var g = h - (domH / 2) + (b / 2);
            $('#save').css('top',g + 'px');
            $(".pop-attention").show()
        } else {
            $(".pop-attention").hide()
        }
    }

    //去除数组指定元素-Start
    Array.prototype.indexOf = function(val) {
        for (var i = 0; i < this.length; i++) {
            if (this[i] == val) return i;
        }
        return -1;
    }

    Array.prototype.remove = function(val) {
        var index = this.indexOf(val);
        if (index > -1) {
            this.splice(index, 1);
        }
    }
    //去除数组指定元素-End
   //弹出规格框
        function showSpec(e){
            spec_dialog=$($(e).attr("data-target"));
            var mask=$(e).attr("data-mask");
            var masklayout=$('<div class="dialog-mask"></div>');
            var width=$(e).attr("data-width");
            if (mask=="1"){
                $("body").append(masklayout);
            }
            spec_dialog.find(".dialog").addClass("open");
            spec_dialog.css({'position':'fixed','z-index':11,'width':width});
            var x=parseInt($(window).width()-spec_dialog.outerWidth())/2;
            var y=parseInt($(window).height()-spec_dialog.outerHeight())/2;
            if (y<=10){y="10"}
            spec_dialog.css({"left":x,"top":y});
            spec_dialog.find(".dialog-close,.close").live('click',function(){
                spec_dialog.find(".dialog").removeClass('open');
                masklayout.remove();
            });
            masklayout.click(function(){
                spec_dialog.find(".dialog").removeClass('open');
                $(this).remove();
            });
        }
</script>